import request from '@/utils/request'

// 获取商品分类列表
export const fetchProCateList = (parentId, params) => {
    return request({
        url: '/productCategory/list/' + parentId,
        method: 'get',
        params: params
    })
}

// 删除商品分类
export const deleteProductCate = (id) => {
    return request({
        url: '/productCategory/delete/' + id,
        method: 'post'
    })
}

// 创建商品分类
export const createProductCate = (data) => {
    return request({
        url: '/productCategory/create',
        method: 'post',
        data: data
    })
}

// 更新商品分类
export const updateProductCate = (id, data) => {
    return request({
        url: '/productCategory/update/' + id,
        method: 'post',
        data: data
    })
}

// 获取商品分类详情
export const getProductCate = (id) => {
    return request({
        url: '/productCategory/' + id,
        method: 'get',
    })
}

// 更新商品分类排序
export const updateShowStatus = (data) => {
    return request({
        url: '/productCategory/update/showStatus',
        method: 'post',
        data: data
    })
}

// 更新商品分类导航状态
export const updateNavStatus = (data) => {
    return request({
        url: '/productCategory/update/navStatus',
        method: 'post',
        data: data
    })
}

// 获取商品分类列表（树形结构）
export const fetchListWithChildren = () => {
    return request({
        url: '/productCategory/list/withChildren',
        method: 'get'
    })
}
